using System;
using System.Reflection;
using System.Threading;
using Microsoft.Office.Interop.Word;

namespace Kassandra.Core
{
    public class CreateImages
    {
        private Document _destinationDocument = null;

        public void With(string text)
        {
            object visible = false;
            object linkToFile = false;
            object saveWithDocument = true;
            object missing = Missing.Value;

            _destinationDocument =
                new ApplicationClass().Documents.Add(ref missing, ref missing, ref missing, ref visible);

            Thread.Sleep(1000);

            foreach (char c in text)
            {
                string imagePath = CreateImagePath(c);
                System.Console.WriteLine(imagePath);
                _destinationDocument.InlineShapes.AddPicture(imagePath, ref linkToFile, ref saveWithDocument,
                                                             ref missing);
            }
        }

        public Document DestinationDocument
        {
            get { return _destinationDocument; }
        }

        private string CreateImagePath(char c)
        {
            return System.Environment.CurrentDirectory + "\\Images\\" + Convert.ToInt16(c) + ".tif";
        }
    }
}